#ifndef __LIB_AGORA_ADMIN_CHANNELMANAGER_H__
#define __LIB_AGORA_ADMIN_CHANNELMANAGER_H__

#include <map>
#include <string>
#include "AdminIChannelManager.h"

namespace AgoraAdmin
{

	class	ChannelManager : public IChannelManager
	{
	public:
		static IChannelManager*				GetChannelManager(void);
		void								LoadChannel(void);
		IChannel*							CreateChannel(const std::string& name, const unsigned int maxNameLenght, const std::string& password, const unsigned int maxPasswordLenght, const std::string& motd, const unsigned int maxMotdLenght, const std::string& description, const unsigned int maxDescriptionLenght, const bool visible, const unsigned int maxUser, const unsigned int maxTalker);
		IChannel*							CreateChannel(IChannel* parent, const std::string& name, const unsigned int maxNameLenght, const std::string& password, const unsigned int maxPasswordLenght, const std::string& motd, const unsigned int maxMotdLenght, const std::string& description, const unsigned int maxDescriptionLenght, const bool visible, const unsigned int maxUser, const unsigned int maxTalker);
		void								DeleteChannel(std::stack<IUser*>& usrToMove);
		void								DeleteChannel(const unsigned int id, std::stack<IUser*>& usrToMove);
		void								DeleteChannel(IChannel*	channel, std::stack<IUser*>& usrToMove);
		void								MoveChannel(const unsigned int idChannel, const unsigned int idParent);
		IChannel*							GetChannel(const unsigned int id);
		IChannel*							GetChannel(const std::string& name);
		bool								ChannelExists(const unsigned int idParent, const std::string& name);
		std::map<unsigned int, IChannel*>&	GetChannelList(void);
		bool								MoveUser(const unsigned int idFromChannel, const unsigned int idToChannel, IUser* user);

	private:
		ChannelManager();
		void								DeleteChildrens(IChannel* channel, std::stack<IUser*>& usrToMove);
		static IChannelManager*				_instance;
		std::map<unsigned int, IChannel*>	_channel;
	};

}

#endif